#include "../source/server.hpp"
//错误测试
//发送数据实际大小小于表明想要发送的大小时
//   1.如果只发送一次，服务器得不到完整的请求，不处理，客户端得不到响应，最终超时关闭
//   2.发送多次，服务器会将后面的请求当作正文处理，而后面处理的时候有可能因为不足一行或者报头缺失一部分处理出错


int main()
{
    Socket cli_sock;
    cli_sock.CreateClient(8085,"127.0.0.1");
    std::string req = "GET /hello HTTP/1.1\r\nConnection: keep-alive\r\nContent-Length: 100\r\n\r\nbitejiuyeke";
    while(1)
    {
        assert(cli_sock.Send(req.c_str(),req.size()) != -1);
        assert(cli_sock.Send(req.c_str(),req.size()) != -1);
        assert(cli_sock.Send(req.c_str(),req.size()) != -1);
        assert(cli_sock.Send(req.c_str(),req.size()) != -1);
        char buf[1024] = {0};
        assert(cli_sock.Recv(buf,1023));
        DBG_LOG("[%s]",buf);
        sleep(3);
    }
    cli_sock.Close();
    return 0;
}